package neo.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import neo.dao.HardwareDao;
import neo.model.Hardware;
import neo.util.ThreadWaiter;

@Service("hardwareService")
public class HardwareService {
	
	@Resource
	private HardwareDao hardwareDao;
	
	public int update(Hardware hardware){
		return hardwareDao.update(hardware);
	}
	
	public Hardware loadById(Integer devId) {
		Hardware hardware = new Hardware();
		if(hardwareDao.haveDid(devId) != 1){
			hardwareDao.add(hardware, devId);
		}
		ThreadWaiter.waitting();
		return hardwareDao.loadById(devId);
	}

}
